import { loc, uDb } from 'sui';

const get_auth = (auth) => {
    const ret = [
        {sn: "1", name: `${loc("l_118")} 1`},
        {sn: "2", name: `${loc("l_118")} 2`},
        {sn: "3", name: `${loc("l_118")} 3`},
    ];

    if (auth) {
        return auth;
    }

    return ret;
};

const load_auth = (setAuth) => {
    uDb(null, "setting/get", {},
        r => {
            const ret = r["auth"];
            setAuth(get_auth(ret));
        },
        e => setAuth(get_auth()));
};

export {get_auth, load_auth};
